package s14.ch16.ex1;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class MyBinaryStreams {

	public static void main(String[] args) throws IOException {
		
		File outFile = new File("output.bin");
		outFile.createNewFile();
		
		InputStream in = new FileInputStream("input.bin");
		OutputStream out = new FileOutputStream(outFile);

		Integer data = null;
		
		while ((data = in.read()) != -1) {
			System.out.println(data);
			System.out.println((char) data.intValue());
			out.write(data);
		}
		
		in.close();
		out.close();
	}

}
